﻿namespace FFF.Test.Entity.FW.Proc
{
    using System;
    using System.Collections.Generic;
    using System.Data.SqlClient;
    using System.IO;
    using System.Data;
    using System.Text;
    using Microsoft.Extensions.Configuration;
    using FFF.Test.Util.Configuration;
    using FFF.Test.Entity.Framework.Proc;
    using FFF.Test.Util.Consts;
    using Ydm.Helper;

	/// <summary>
    /// usp_FW_GenFUnction存储过程
    /// </summary>
    public class UspFWGenFUnction : BaseProc
    {        
        /// <summary>
        /// @FunctionCode
        /// </summary>
        public string FunctionCode { get; set; } 
        
        /// <summary>
        /// @FunctionName
        /// </summary>
        public string FunctionName { get; set; } 
        
        /// <summary>
        /// @ParentFunctionName
        /// </summary>
        public string ParentFunctionName { get; set; } 
        
        /// <summary>
        /// 设置参数的集合
        /// </summary>
        /// <returns>参数集合</returns>
        public override SqlParameter[] GetSqlParameters()
        {
            List<SqlParameter> parameters = new List<SqlParameter>();
            parameters.Add(new SqlParameter("@FunctionCode", this.FunctionCode));
            parameters.Add(new SqlParameter("@FunctionName", this.FunctionName));
            parameters.Add(new SqlParameter("@ParentFunctionName", this.ParentFunctionName));
            return parameters.ToArray();
        }

        /// <summary>
        /// 获取sql
        /// </summary>
        /// <returns>获取sqlstr</returns>
        public override string GetSql()
        {
            string sql = "EXEC dbo.usp_FW_GenFUnction ";
            sql += " @FunctionCode = @FunctionCode,";
           
            sql += " @FunctionName = @FunctionName,";
           
            sql += " @ParentFunctionName = @ParentFunctionName,";
           
            sql = sql.Substring(0, sql.Length - 1);
            return sql;
        }
    }
}
